<!doctype html>
<html lang="zh-CN">
<header>
    <title>Asgard Framework - {{.Subtitle}}</title>
    {{include "layouts/header"}}
</header>

<body class="antialiased">
    {{include "layouts/sidebar"}}
    <div class="content">
        {{include "layouts/top"}}
        <div class="content-page">
            <main class="container my-4 flex-fill">
                {{template "content" .}}
            </main>
        </div>
    </div>
</body>
<footer>
    {{include "layouts/footer"}}
</footer>
{{template "script" .}}
<script>
    $(document).ready(function () {
        var path = window.location.pathname;
        $(".sidebar-nav li a").each(function () {
            var href = $(this).attr("href");
            if (href == path) {
                $(this).addClass("active")
                return false;
            }
        });
        $.getJSON("/user/info", function (data) {
            if (data.code == 200) {
                var html = data.data.nickname + "<span class=\"text-muted d-block mt-1 text-h6\">" + data.data.role + "</span>"
                $("#user_info").html(html)
                $("#user_avatar").css("background-image", "url(" + data.data.avatar + ")");
            } else {
                alert(data.message);
            }
        });
    }); 
</script>
</html>
